Beispiel2.txt
*******************************************
Beispiele mit Grafik "Script Turtle"

Koch1 und Koch2

Script mit Doppelklick oder STRG+R aufrufen
===========================================

____________________________________________
Koch1
=====
ScriptBegin
var Grafik = "Script Turtle";
var l=3.25;

function init()
{ t.setBrush("white");  
}

function koch(n)
{ if (n<1) t.move(l)
  else
  { koch(n-1); 
    t.turn(60);
    koch(n-1);
    t.turn(-120);
    koch(n-1);
    t.turn(60);  
    koch(n-1);
  }  
} 

function draw()
{ t.drawKoordSystem();
  t.drawRaster();

  t.setPen("red",1);
  t.setBrush("silver");

  t.beginPolygon();
  t.goTo(-130,-20); 
  koch(4);

  t.turn(-90);   t.move(31,1);
  t.moveTo(-130, t.lastY());
  t.endPolygon();

  t.goTo(0,0); t.turnTo(0); t.drawPolygon();
}
ScriptEnd
____________________________________________


____________________________________________

Koch2
=====
ScriptBegin
var Grafik = "Script Turtle";
var l=1.8;
var n=4;

function init()
{ t.setBrush("white");
}

function koch(n)
{ if (n<1) t.move(l)
  else
  { koch(n-1); 
    t.turn(60);
    koch(n-1);
    t.turn(-120);
    koch(n-1);
    t.turn(60);  
    koch(n-1);
  }  
} 

function draw()
{ t.drawKoordSystem();
  t.drawRaster();
 
  t.setPen("blue",0);
  t.setBrush("silver");

  t.beginPolygon();
  t.goTo(-60,-40);
  t.turnTo(60);
  koch(n); t.turn(-120);
  koch(n); t.turn(-120);
  koch(n); t.moveTo(-60,-40);
  t.endPolygon(); 

  t.goTo(0,0); t.turnTo(0); t.drawPolygon();
}
ScriptEnd
____________________________________________



